//
//  GloalMacro.h
//  KTVShopProduct
//  全局宏变量
//  Created by paeanSs on 2017/11/8.
//  Copyright © 2017年 paeanSs. All rights reserved.
//

#ifndef GloalMacro_h
#define GloalMacro_h

#pragma mark -general section


// 获取 屏幕的宽 和 高
#define KTScreenWidth     [[UIScreen mainScreen] bounds].size.width
#define KTScreenHeight    [[UIScreen mainScreen] bounds].size.height

// 判断系统是不是 iOS7以上的
#define iOS7Later [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0
#define IOS8Later [[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0
#define IOS9Later [[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0
#define IOS10Later [[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0



#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125,2436), [[UIScreen mainScreen] currentMode].size) : NO)

//判断设备屏幕 是不是 iphone6
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750,1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6p ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242,2208), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6pZoomModel ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125,2001), [[UIScreen mainScreen] currentMode].size) : NO)
//iphone6  或者 iphone6p
#define iphone6Or6p (iPhone6||iPhone6p||iPhone6pZoomModel)
// 判断 设备的屏幕 是不是iphone5
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
// 判断 设备的屏幕 是不是iphone4
#define iPhone4s ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

//tabBar高度
#define TabbarHeight     ([[UIApplication sharedApplication] statusBarFrame].size.height>20?83:49) // 适配iPhone x 底栏高度

//判断设备是不是ipad
#define iPad ((FSScreenHeight / FSScreenWidth) == 1.5) && !iPhone4s

//适配宽高
#define kScreenWidthRatio  (FSScreenWidth / 750.0)
#define kScreenHeightRatio (FSScreenHeight / 568.0)
#define AdaptedWidthValue(x)  (ceilf((x) * kScreenWidthRatio))
#define AdaptedHeightValue(x) (ceilf((x) * kScreenHeightRatio))


#define iOSVersion [[UIDevice currentDevice].systemVersion floatValue]

#define ZXRGBA(r,g,b,a) [UIColor colorWithRed:(float)r/255.0f green:(float)g/255.0f blue:(float)b/255.0f alpha:a]
#define ZXRGB(r,g,b) [UIColor colorWithRed:(float)r/255.0f green:(float)g/255.0f blue:(float)b/255.0f alpha:1]

#define UIColorFromHex(s) [UIColor colorWithRed:(((s & 0xFF0000) >> 16))/255.0       green:(((s &0xFF00) >>8))/255.0 blue:((s &0xFF))/255.0 alpha:1.0]
#define UIColorFromHexA(s,a) [UIColor colorWithRed:(((s & 0xFF0000) >> 16))/255.0       green:(((s &0xFF00) >>8))/255.0 blue:((s &0xFF))/255.0 alpha:a]


#define  ZX_SINGLETON_INTERFACE(class) \
+ (class*)sharedInstance;

#define ZX_SINGLETON_IMPL(class) \
static class* gInstance = nil; \
+ (class*)sharedInstance { \
if (!gInstance) { \
@synchronized(self) { \
if (!gInstance) gInstance = [[self alloc] init]; \
} \
} \
return gInstance; \
}

#define HD_SINGLETON_DESTORY() \
+ (void)destorySharedInstance\
{\
gInstance = nil;\
}



#define WEAKSELF __weak __typeof(&*self)weakSelf = self;


//打印frame
#define HDLogFrame(frame)  \
{\
NSLog(@"frame:%@", [NSValue valueWithCGRect:frame]);\
}

//打印point
#define HDLogPoint(point)  \
{\
NSLog(@"frame:%@", [NSValue valueWithCGPoint:point]);\
}


#pragma mark -custom section


//默认正常颜色（浅灰色）
#define NormalDefalutColor [UIColor colorWithRed:(((0x9c9c9c & 0xFF0000) >> 16))/255.0       green:(((0x9c9c9c &0xFF00) >>8))/255.0 blue:((0x9c9c9c &0xFF))/255.0 alpha:1.0]
//默认选中颜色（金色）
#define SelectDefalutColor [UIColor colorWithRed:(((0xcbab6c & 0xFF0000) >> 16))/255.0       green:(((0xcbab6c &0xFF00) >>8))/255.0 blue:((0xcbab6c &0xFF))/255.0 alpha:1.0]





#endif /* GloalMacro_h */
